using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Terra.Core.Common.ApiResponse;
using Terra.Core.Common.Models.Common;
using Terra.Core.Common.Models.Pagination;
using Terra.Data.Models.Identity;
using Terra.Service.Common.Base;

namespace Terra.Service.Identity.Interfaces
{
    /// <summary>
    /// 部门管理服务接口
    /// </summary>
    public interface IDeptService : IAppService
    {
        #region 查询操作

        /// <summary>
        /// 获取部门详情
        /// </summary>
        /// <param name="id">部门ID</param>
        /// <returns>部门详情</returns>
        Task<ApiResponse<DeptDetailDto>> GetDeptByIdAsync(Guid id);

        /// <summary>
        /// 获取部门树
        /// </summary>
        /// <param name="status">部门状态，默认为启用状态</param>
        /// <returns>部门树形结构</returns>
        Task<ApiResponse<List<DeptTreeDto>>> GetDeptTreeAsync(int? status = 1);

        /// <summary>
        /// 获取部门选择列表
        /// </summary>
        /// <param name="status">部门状态，默认为启用状态</param>
        /// <returns>部门选择列表</returns>
        Task<ApiResponse<List<DeptSelectDto>>> GetDeptSelectsAsync(int? status = 1);

        /// <summary>
        /// 分页查询部门列表
        /// </summary>
        /// <param name="queryDto">查询参数</param>
        /// <returns>分页结果</returns>
        Task<ApiResponse<PagedList<DeptItemDto>>> GetPagedDeptsAsync(DeptQueryDto queryDto);

        #endregion

        #region 业务操作

        /// <summary>
        /// 创建部门
        /// </summary>
        /// <param name="createDto">创建参数</param>
        /// <returns>创建结果</returns>
        Task<ApiResponse<Guid>> CreateDeptAsync(DeptCreateDto createDto);

        /// <summary>
        /// 更新部门
        /// </summary>
        /// <param name="id">部门ID</param>
        /// <param name="updateDto">更新参数</param>
        /// <returns>更新结果</returns>
        Task<ApiResponse> UpdateDeptAsync(Guid id, DeptUpdateDto updateDto);

        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="id">部门ID</param>
        /// <returns>删除结果</returns>
        Task<ApiResponse> DeleteDeptAsync(Guid id);

        /// <summary>
        /// 更新部门状态
        /// </summary>
        /// <param name="id">部门ID</param>
        /// <param name="status">状态：1-启用，0-禁用</param>
        /// <returns>更新结果</returns>
        Task<ApiResponse> UpdateDeptStatusAsync(Guid id, int status);

        /// <summary>
        /// 批量删除部门
        /// </summary>
        /// <param name="ids">部门ID列表</param>
        /// <returns>批量删除结果</returns>
        Task<ApiResponse<BatchOperationResult>> BatchDeleteDeptsAsync(List<Guid> ids);

        #endregion
    }
}